{extend name="common/base" /}
{block name="body"}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">修改密码</div>
                        <div class="layui-card-body">
                            <div class="layui-form" lwid100 iwid300 lay-filter="form">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">旧密码</label>
                                    <div class="layui-input-inline">
                                        <input type="password" lay-verify="required" name="old_pass" value=""
                                               autocomplete="off"
                                               class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">新密码</label>
                                    <div class="layui-input-inline">
                                        <input type="password" lay-verify="required" name="user_pass" value=""
                                               autocomplete="off"
                                               class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">确认新密码</label>
                                    <div class="layui-input-inline">
                                        <input type="password" lay-verify="required" name="confirm_user_pass" value=""
                                               autocomplete="off"
                                               class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <button class="layui-btn" lay-submit lay-filter="form">提交</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="my_js"}
<script>
    layui.use(['element', 'admin', 'form'], function () {
        var element = layui.element
            , admin = layui.admin
            , $ = layui.$
            , form = layui.form;
        form.on('submit(form)', function (data) {
            admin.ajax('admin/profile/changePwd', data.field, function (data) {
                if (data.code == 1001) {
                    layer.msg(data.msg, function () {
                        location.reload();
                    });
                } else {
                    layer.msg(data.msg);
                }
            }, '', 'put');
        });
    });
</script>
{/block}